<?php

/**
 * @author HungNQ
 * Copy __get and __set method from php.net
 */
class AttendanceRow
{

    public $attendanceDetails = array();
    public $date = 0;

    /**  Location for overloaded data.  */
    private $data = array();
    public $present = array();
    public $paid = array();
    public $unpaid = array();
    public $total_paid = 0;
    public $paid_detail = array();
    
    public function __set($name, $value)
    {
        $this->data[$name] = $value;
    }

    public function __get($name)
    {
        if (array_key_exists($name, $this->data)) {
            return $this->data[$name];
        }
        return null;
    }

    public function getDayInWeek()
    {
        return date("w", $this->date);
    }

    public function isWeekend()
    {
        if ($this->getDayInWeek() == 0 || $this->getDayInWeek() == 6) {
            return true;
        }
        return false;
    }

    public function getAttendanceDetails()
    {
        if (count($this->attendanceDetails)) {
            return "<ul><li>" . implode('</li><li>', $this->attendanceDetails) . "</li></ul>";
        }
        return '-';
    }

}